package com.desire.homework;

public class _11_九九乘法表 {
    /**
     * 标准九九乘法口诀表(左对齐)
     *
     * @param args
     */
    public static void main1(String[] args) {
        for (int i = 1; i <= 9; i++) {
            System.out.println();
            for (int j = 1; j <= i; j++) {
                System.out.print(j + "*" + i + "=" + i * j + "\t");
            }
        }
    }

    /**
     * 乘法口诀表(倒 左对齐)
     *
     * @param args
     */
    public static void main4(String[] args) {
        for (int a = 1; a <= 9; a++) {
            for (int b = a; b <= 9; b++) {
                System.out.print(a + "*" + b + "=" + (a * b) + "\t");
            }
            System.out.print("\n");
        }
    }

    /**
     * 乘法口诀表(右对齐)
     *
     * @param args
     */
    public static void main3(String[] args) {
        for (int a = 9; a >= 1; a--) {
            for (int c = 1; c < a; c++) {
                System.out.print("\t");
            }
            for (int b = a; b <= 9; b++) {
                System.out.print(a + "*" + b + "=" + (a * b) + "\t");
            }
            System.out.print("\n");
        }

    }


    /**
     * 乘法口诀表(倒 右对齐)
     *
     * @param args
     */
    public static void main2(String[] args) {
        for (int i = 1; i <= 9; i++) {
            for (int x = 0; x < i - 1; x++) {
                System.out.print("\t");
            }
            for (int j = i; j <= 9; j++) {
                System.out.print(i + "*" + j + "=" + i * j + "\t");
            }
            System.out.println();
        }
    }
}
